<template>
  <div class="container">
    <el-steps
      :active="this.status"
      simple
      process-status="finish"
      finish-status="success"
      v-if="this.status<= 3 ? true:false"
    >
      <el-step title="申请供应商" icon="el-icon-edit"></el-step>
      <el-step title="审核中" icon="el-icon-more"></el-step>
      <el-step title="进入管理系统" icon="el-icon-check"></el-step>
    </el-steps>
    <el-button  class="title" type="text" size="medium " @click="handleToLogin">退出登陆</el-button>
    <store-theAppli v-if="status==0"></store-theAppli>
    <wait v-if="status==2"></wait>
    <unpass v-if="status==5"></unpass>
    <pass v-if="status==3"></pass>
    <close v-if="status==4"></close>
  </div>
</template>

<script>
import { removeToken } from '@/utils/auth' 
import {getsupolierById} from "@/api/zjm_Foods"
import Axios from "axios";
import { mapState } from "vuex";
import wait from "./wait";
import unpass from "./unpass";
import pass from "./pass";
import close from "./close";
import StoreTheAppli from "./StoreTheAppli";
export default {
  data() {
    return {
      status: undefined
    };
  },
  components: {
    wait,
    unpass,
    pass,
    close,
    StoreTheAppli
  },
  computed: {
    ...mapState("user", ["_id"])
  },
  methods:{
      async handleToLogin(){
            await this.$store.dispatch('user/logout')
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
      }
  },
  created() {
    Axios({
      url: "/api/admin/getAdminById",
      method: "get",
      params: {
        _id: this._id
      }
    }).then(res => {
      const { data } = res;
      if (data.status == 1) {
        this.$router.replace("/dashboard");
      } else {
        this.status = data.status;
        
      }
    });
  },
};
</script>

<style scoped>

.container {
  min-height: 100%;
  width: 100%;
  overflow: hidden;
}
.title{
    float: right;
    margin: 20px
}
</style>